package com.ssh;

import org.junit.Test;

public class Divide_29 {
	public int divide(int dividend, int divisor) {
		if (dividend < 1 || divisor < 1) {
			return 0;
		}
		if (dividend == 1 || divisor == 1) {
			return 1;
		}
		if (dividend < divisor) {
			return divide(dividend, dividend);
		}
		if (dividend == divisor) {
			return 1 + divide(dividend, divisor-1);
		}
		return divide(dividend-divisor, divisor) + divide(dividend, divisor-1);
	}
	
	@Test
	public void test() {
		System.out.println(divide(6, 6));
	}
}
